import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:jinke/page/pro_list/subs/pro_open/subs/pro_open_step1/widgets/add_num.dart';

import '../../../../../../utils/component/component.dart';
import '../../../../../../utils/component/selected_tag_view.dart';
import '../../../../../../utils/util.dart';
import '../../main/widgets/pro_brife.dart';
import 'index.dart';
import 'widgets/widgets.dart';

class ProOpenStep1Page extends StatelessWidget {
  ProOpenStep1Page({Key? key}) : super(key: key);
  final controller = Get.put(ProOpenStep1Controller());
  // 主视图
  Widget _buildView() {
    return ListView(
      padding: EdgeInsets.only(bottom: 80.r),
      children: [
        ProBrifeWidget(),
        Padding(
          padding: EdgeInsets.symmetric(horizontal: 16.r),
          child: AddNumWidget(
            title: '投资金额：',
            subTitle: '亿元',
            floatCount: 1,
            onChanged: (p0) {
              Get.log(p0.toString());
              controller.state.putMoney = p0.toInt();
            },
          ),
        ),
        Padding(
          padding: EdgeInsets.symmetric(horizontal: 16.r),
          child: AddNumWidget(
            title: '用工人数：',
            subTitle: '人',
            onChanged: (p0) {
              Get.log(p0.toString());
              controller.state.putPeople = p0.toInt();
            },
          ),
        ),
        Container(
          margin: EdgeInsets.symmetric(horizontal: 16.r, vertical: 10.r),
          padding: EdgeInsets.all(16.r),
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.circular(4.r),
          ),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                '项目类型',
                style: TextStyle(
                  color: ColorsUtil.title,
                  fontSize: 14.sp,
                ),
              ),
              SizedBox(
                height: 10.r,
              ),
              SelectTagView(
                items: const ['重大项目', '一般项目'],
                initIndexs: [0],
                isFixed: false,
                height: 30.r,
                width: 80.r,
                spacing: 10.r,
                selectedTextStyle: TextStyle(
                  color: Colors.white,
                  fontSize: 14.sp,
                ),
                selectedTagBgColor: ColorsUtil.blue,
                tagBgColor: ColorsUtil.bg,
                textStyle: TextStyle(
                  color: ColorsUtil.title,
                  fontSize: 14.sp,
                ),
              ),
            ],
          ),
        ),
        Container(
          margin: EdgeInsets.symmetric(horizontal: 16.r),
          padding: EdgeInsets.fromLTRB(16.r, 0, 16.r, 16.r),
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.circular(4.r),
          ),
          child: Column(
            children: [
              Container(
                height: 50.r,
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text(
                      '备注：',
                      style:
                          TextStyle(color: ColorsUtil.title, fontSize: 16.sp),
                    ),
                    Icon(
                      Icons.keyboard_voice,
                      color: ColorsUtil.blue,
                      size: 20.r,
                    ),
                  ],
                ),
              ),
              Container(
                padding: EdgeInsets.all(gap15),
                decoration: BoxDecoration(
                  color: ColorsUtil.bg,
                  borderRadius: BorderRadius.circular(4.r),
                ),
                child: TextField(
                  controller: controller.state.remarkCtrl,
                  maxLength: 800,
                  maxLines: 4,
                  textAlignVertical: TextAlignVertical.top,
                  style: TextStyle(
                    color: ColorsUtil.title,
                    fontSize: 14.sp,
                  ),
                  decoration: InputDecoration(
                    fillColor: ColorsUtil.bg,
                    isCollapsed: false,
                    border: InputBorder.none,
                    hintText: '请输入项目备注',
                    hintStyle: TextStyle(
                      color: ColorsUtil.placeholder,
                      fontSize: 14.sp,
                    ),
                  ),
                ),
              ),
            ],
          ),
        )
      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<ProOpenStep1Controller>(
      builder: (_) {
        return Scaffold(
          body: SafeArea(child: _buildView()),
        );
      },
    );
  }
}
